TTOP_SUB_FLAG 		= SUB_SUB
export TTOP_SUB_FLAG

include ../../config.local
include $(RULESDIR)/config_comm
include ./head.rules
include $(RULESDIR)/rule.local

DEMOSRCS    = $(wildcard *.cpp)

DEMOOBJS    :=  $(DEMOSRCS:%.cpp=%.o)

DEMOTARGET	:= $(TARGETDIR)/bin/ec_it8733_demo

#NFSTARGET := $(TTOP)/../../nfs/test_tool_BM6J58

#applibs-y += -L$(TOPUSERLIBDIR) -llog4cplus
#applibs-y += -L$(TARGETDIR)/lib -ldswlivevideo
#applibs-y += -ldswrecoder
#applibs-y += -lssl
#applibs-y += -lcrypto -lz

#applibs-y += -ldswhashtable
#applibs-y += -L$(TOPGMLIBDIR) -lgm


applibs-y += -L$(TARGETDIR)/lib -lec_it8733
applibs-y += -lttyrw
#applibs-y += -lwin_fan_temp



#applibs-y += -L$(TARGETDIR)/lib -lmarkup
#applibs-y += -ljson

#applibs-y += -lmarkup

#applibs-y += -lec_it87337

#applibs-y += -lstdc++

applibs-y += -lpthread -lm

#applibs-y += -ldl -lnsl -lrt -lresolv

applibs-y += -lmenu -lncurses

all: $(DEMOTARGET)

#include $(RULESDIR)/rule.local

$(DEMOOBJS): %.o :%.cpp
	@echo "ARCHDEF="$(ARCHDEF)
	@echo " CC $<"
	$(CC) -c $(CFLAGS) -o $@ $<

$(DEMOTARGET):$(DEMOOBJS)
	@echo "Building Targets....."

	$(CC) $(CXXFLAGS) -Wall -o $(DEMOTARGET) $(DEMOOBJS) $(applibs-y)
	$(STRIP) $(DEMOTARGET)
#	$(TARGETDIR)/upx/upx $(DEMOTARGET)

#	/bin/cp $(DEMOTARGET) $(NFSTARGET)
	#/bin/cp ../libusr/lib_json/*.json $(TARGETDIR)/bin/
	#/bin/cp ../libusr/lib_json/*.txt $(TARGETDIR)/bin/
	/bin/cp ../../ec_it8733_uos/run.sh $(TARGETDIR)/bin/
	/bin/cp ../../ec_it8733_uos/ec_it8733_dev/ec_it8733_dev.ko $(TARGETDIR)/bin/


clean: 
	/bin/rm -f *.o $(DEMOTARGET) #$(NFSTARGET)

